const schedulesService = require('../../dao/schedules/schedulesDao.js');


module.exports = {
    // 显示所有信息
    async showAllInfo() {
        return await schedulesService.showAll()
    },
    //增加信息
    async insertSchedulesInfo(movieId, cinemasId, theaterId, showTime, price) {
        return await schedulesService.insertSchedules(movieId, cinemasId, theaterId, showTime, price)
    },
    //删除信息
    async deleteSchedulesInfo(SchedulesId) {
        return await schedulesService.deleteSchedules(SchedulesId);
    },
    // 查询信息
    async showSchedulesInfo(_id) {
        return await schedulesService.showSchedules(_id);
    },
    //修改信息
    async updateSchedulesInfo({
        _id,
        movieId,
        cinemasId,
        theaterId,
        showTime,
        price
    }) {
        return await schedulesService.updateSchedules({
            _id,
            movieId,
            cinemasId,
            theaterId,
            showTime,
            price
        })
    },
    //分页
    async getAccessToPag({
        currentpage,
        pagesize
    }) {
        //创建一个空对象
        let pagedata = {};
        //当前页数
        pagedata.currentpage = currentpage;
        //每页显示的条数
        pagedata.pagesize = pagesize;
        //显示的数据
        pagedata.data = await schedulesService.accessToPag({
            currentpage,
            pagesize
        });
        //总条数
        pagedata.totalInt = await schedulesService.getsNumber();
        //总页数
        pagedata.totalSize = Math.ceil(pagedata.totalInt / pagesize);
        return pagedata
    },
}